//package com.navinfo.opentsp.platform.computing.analysis.entity.drivingAnalysis;
//
//import com.navinfo.opentsp.platform.computing.analysis.util.NumberFormatUtil;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//import org.bson.Document;
//
//import java.io.Serializable;
//
//@Data
//@NoArgsConstructor
//public class OperationStateBean implements Serializable {
//    private int status;
//    private long duration;
//    private double oilConsumption;
//    private double mileage;
//
//    public OperationStateBean(int status){
//        this.status = status;
//    }
//
//    public void addDuration(StatisticsBean statisticsBean){
//        long diffDuration = statisticsBean.getEndTS() - statisticsBean.getStartTS();
//        this.duration +=  diffDuration;
//        this.oilConsumption += statisticsBean.getOilConsumption();
//        this.mileage += statisticsBean.getMileage();
//    }
//
//    public Document toDoc(){
//        Document doc = new Document();
//        doc.put("status",status);
//        doc.put("duration", duration);
//        doc.put("oilConsumption", Double.parseDouble(NumberFormatUtil.format(oilConsumption)));
//        doc.put("mileage", Double.parseDouble(NumberFormatUtil.format(mileage)));
//        return doc;
//    }
//
//    public OperationStatusPie toProto(){
//        return OperationStatusPie
//                .newBuilder()
//                .setDuration(duration)
//                .setMileage(mileage)
//                .setOilConsumption(oilConsumption)
//                .setStatus(status)
//                .build();
//    }
//}
